﻿using System;
using System.Collections.Generic;
using Citi.GLCosmos.Domain.Utils;

namespace Citi.GLCosmos.Domain
{
    public partial class GL
    {
        public static void CopyFromTempTable(DateTime date)
        {
            Context.Instance.CommandTimeout = 3600;
            Context.Instance.CopyFromTemp(date);
        }

        public static IEnumerable<MakeGLReportResult> GenerateReport(DateTime date, string otType)
        {
            Context.Instance.CommandTimeout = 18000;
            var dateReport = date.DayOfWeek == DayOfWeek.Monday || date.DayOfWeek == DayOfWeek.Tuesday
                ? date.AddDays(-4)
                : date.AddDays(-2);

            return Context.Instance.MakeGLReport(dateReport.Month, date.Year, otType);
        }
    }
}
